﻿using log4net;
using System.Collections.Generic;
using System.Linq.Expressions;

namespace LeakView.common
{

    public interface Splashable
    {
        void splash(bool flag);
    }

    class Splashables : List<Splashable>, Splashable
    {
        public void splash(bool flag)
        {
            this.ForEach((s) =>
            {
                s.splash(flag);
            });
        }
    }

    class Splash : List<Splashable>
    {
        private static readonly ILog log = LogManager.GetLogger(typeof(Splash));

        private bool flag = false;

        public void splash()
        {
            flag = !flag;
            this.ForEach((s) =>
            {
                try
                {
                    s.splash(flag);
                }
                catch (System.Exception e)
                {
                    log.Error("splash exception catched.", e);
                }
                
            });
        }
    }
}
